﻿using System.Text;

namespace AbstractFactory.List
{
    internal class ListTray : Tray
    {
        public ListTray(string caption) : base(caption)
        {
        }

        public override string MakeHtml()
        {
            var buffer = new StringBuilder();
            buffer.Append("<li>\n");
            buffer.Append($"{caption}\n");
            buffer.Append("<ul>\n");
            foreach (var item in tray)
            {
                buffer.Append(item.MakeHtml());
            }
            buffer.Append("</ul>\n");
            buffer.Append("</li>\n");
            return buffer.ToString();
        }
    }
}
